﻿using System;
using System.ComponentModel;
using NewLife.CommonEntity;
using XCode;

namespace BingZi.HY.Core.Entities.System
{
    /// <summary>
    /// 会员信息
    /// </summary>
    [BindTable("UserInfo", Description = "会员", ConnName = "Common")]
    public  class UserInfo : Administrator<UserInfo, MemberLevel, Menu, RoleMenu, Log>
    {
        #region 属性




        private String _QQ;
        /// <summary>
        /// QQ
        /// </summary>
        [Description("QQ")]
        [DataObjectField(false, false, true, 15)]
        [BindColumn(11, "QQ", "QQ", "", "varchar(15)", 0, 0, true)]
        public String QQ
        {
            get { return _QQ; }
            set { if (OnPropertyChange("QQ", value)) _QQ = value; }
        }

        private String _MSN;
        /// <summary>
        /// MSN
        /// </summary>
        [Description("MSN")]
        [DataObjectField(false, false, true, 50)]
        [BindColumn(12, "MSN", "MSN", "", "nvarchar(50)", 0, 0, true)]
        public String MSN
        {
            get { return _MSN; }
            set { if (OnPropertyChange("MSN", value)) _MSN = value; }
        }

        private String _Email;
        /// <summary>
        /// 邮件
        /// </summary>
        [Description("邮件")]
        [DataObjectField(false, false, true, 50)]
        [BindColumn(13, "Email", "邮件", "", "nvarchar(50)", 0, 0, true)]
        public String Email
        {
            get { return _Email; }
            set { if (OnPropertyChange("Email", value)) _Email = value; }
        }

        private String _Phone;
        /// <summary>
        /// 电话
        /// </summary>
        [Description("电话")]
        [DataObjectField(false, false, true, 50)]
        [BindColumn(14, "Phone", "电话", "", "nvarchar(50)", 0, 0, true)]
        public String Phone
        {
            get { return _Phone; }
            set { if (OnPropertyChange("Phone", value)) _Phone = value; }
        }



        private String _MobilePhone;
        /// <summary>
        /// 移动电话
        /// </summary>
        [Description("移动电话")]
        [DataObjectField(false, false, true, 20)]
        [BindColumn(15, "MobilePhone", "移动电话", "", "varchar(20)", 0, 0, false)]
        public String MobilePhone
        {
            get { return _MobilePhone; }
            set { if (OnPropertyChange("MobilePhone", value)) _MobilePhone = value; }
        }


        private String _Fax;
        /// <summary>
        /// 传真
        /// </summary>
        [Description("传真")]
        [DataObjectField(false, false, true, 20)]
        [BindColumn(16, "Fax", "传真", "", "varchar(20)", 0, 0, false)]
        public String Fax
        {
            get { return _Fax; }
            set { if (OnPropertyChange("Fax", value)) _Fax = value; }
        }


        private String _Position;
        /// <summary>
        /// 职位
        /// </summary>
        [Description("职位")]
        [DataObjectField(false, false, true, 20)]
        [BindColumn(17, "Position", "职位", "", "varchar(20)", 0, 0, false)]
        public String Position
        {
            get { return _Position; }
            set { if (OnPropertyChange("Position", value)) _Position = value; }
        }

        private Int32 _Sex;
        /// <summary>
        /// 性别(0:保密;1:先生;2:女士)
        /// </summary>
        [Description("Sex")]
        [DataObjectField(false, false, true, 3)]
        [BindColumn(18, "Sex", "Sex", "0", "tiyint", 3, 0, true)]
        public Int32 Sex
        {
            get { return _Sex; }
            set { if (OnPropertyChange("Sex", value)) _Sex = value; }
        }


        #endregion

        #region 获取/设置 字段值
        /// <summary>
        /// 获取/设置 字段值。
        /// 一个索引，基类使用反射实现。
        /// 派生实体类可重写该索引，以避免反射带来的性能损耗
        /// </summary>
        /// <param name="name">字段名</param>
        /// <returns></returns>
        public override Object this[String name]
        {
            get
            {
               
                switch (name)
                {
                    case "ID": return this.ID;
                    case "Name": return this.Name;
                    case "Password": return this.Password;
                    case "DisplayName": return this.DisplayName;
                    case "RoleID": return this.RoleID;
                    case "Logins": return this.Logins;
                    case "LastLogin": return this.LastLogin;
                    case "LastLoginIP": return this.LastLoginIP;
                    case "SSOUserID": return this.SSOUserID;
                    case "IsEnable": return this.IsEnable;
                    case "QQ": return _QQ;
                    case "MSN": return _MSN;
                    case "Email": return _Email;
                    case "Phone": return _Phone;
                    case "MobilePhone": return _MobilePhone;
                    case "Fax": return _Fax;
                    case "Position": return _Position;
                    case "Sex": return _Sex;
                    default: return base[name];
                }
            }
            set
            {
                switch (name)
                {
                    case "ID": this.ID = Convert.ToInt32(value); break;
                    case "Name": this.Name = Convert.ToString(value); break;
                    case "Password": this.Password = Convert.ToString(value); break;
                    case "DisplayName": this.DisplayName = Convert.ToString(value); break;
                    case "RoleID": this.RoleID = Convert.ToInt32(value); break;
                    case "Logins": this.Logins = Convert.ToInt32(value); break;
                    case "LastLogin": this.LastLogin = Convert.ToDateTime(value); break;
                    case "LastLoginIP": this.LastLoginIP = Convert.ToString(value); break;
                    case "SSOUserID": this.SSOUserID = Convert.ToInt32(value); break;
                    case "IsEnable": this.IsEnable = Convert.ToBoolean(value); break;
                    case "QQ": _QQ = Convert.ToString(value); break;
                    case "MSN": _MSN = Convert.ToString(value); break;
                    case "Email": _Email = Convert.ToString(value); break;
                    case "Phone": _Phone = Convert.ToString(value); break;
                    case "MobilePhone": _MobilePhone = Convert.ToString(value); break;
                    case "Fax":   _Fax = Convert.ToString(value); break;
                    case "Position": _Position = Convert.ToString(value); break;
                    case "Sex": _Sex = Convert.ToInt32(value); break; 
                    default: base[name] = value; break;
                }
            }
        }
        #endregion

        #region 字段名
        /// <summary>
        /// 取得会员字段名的快捷方式
        /// </summary>
        public class _
        {
            ///<summary>
            /// 编号
            ///</summary>
            public const String ID = "ID";

            ///<summary>
            /// 名称
            ///</summary>
            public const String Name = "Name";

            ///<summary>
            /// 密码
            ///</summary>
            public const String Password = "Password";

            ///<summary>
            /// 显示名
            ///</summary>
            public const String DisplayName = "DisplayName";

            ///<summary>
            /// 角色
            ///</summary>
            public const String RoleID = "RoleID";

            ///<summary>
            /// 登录次数
            ///</summary>
            public const String Logins = "Logins";

            ///<summary>
            /// 最后登录
            ///</summary>
            public const String LastLogin = "LastLogin";

            ///<summary>
            /// 最后登陆IP
            ///</summary>
            public const String LastLoginIP = "LastLoginIP";

            ///<summary>
            /// 登录用户编号
            ///</summary>
            public const String SSOUserID = "SSOUserID";

            ///<summary>
            /// 是否使用
            ///</summary>
            public const String IsEnable = "IsEnable";

            ///<summary>
            /// 名称
            ///</summary>
            public const String QQ = "QQ";

            ///<summary>
            /// MSN
            ///</summary>
            public const String MSN = "MSN";

            ///<summary>
            /// 邮件
            ///</summary>
            public const String Email = "Email";

            ///<summary>
            /// 电话
            ///</summary>
            public const String Phone = "Phone";
            /// <summary>
            /// 移动电话
            /// </summary>
            public const String MobilePhone = "MobilePhone";
            /// <summary>
            /// 传真
            /// </summary>
            public const String Fax = "Fax";
            /// <summary>
            /// 职位
            /// </summary>
            public const String Position = "Position";


            public const String Sex = "Sex";
        }
        #endregion
    }
}